﻿<KCtl:BaseUserControl xmlns:my="clr-namespace:Kiva7.Pages"  
                      x:Class="Kiva7.Pages.LoanAndDetailControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:KCtl="clr-namespace:Kiva7.Controls"
    mc:Ignorable="d"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    d:DesignHeight="480" d:DesignWidth="480">
    
    <Grid>

        <ScrollViewer Visibility="{Binding IsLoaded, Converter={StaticResource booleanToVisibility}}">

            <Grid x:Name="LayoutRoot" Background="{StaticResource KivaBackgroundBrush}" DataContext="{Binding SingleData}">

                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="*" />
                </Grid.RowDefinitions>

                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>

                <StackPanel Grid.Row="0" Grid.ColumnSpan="2"
                    Style="{StaticResource KivaPanelTextLargeStyle}" Margin="12,0,0,0">
                    <TextBlock Text="{Binding Name}" Style="{StaticResource KivaTextLargeStyle}"
                           TextWrapping="Wrap"/>
                </StackPanel>
                
                <Button Grid.Row="1" Click="Button_Click" BorderThickness="0" Margin="0,0,0,0" Padding="0">
                    <KCtl:KivaImageControl x:Name="imgLender" ImageSize="Normal" 
                                           ImageData="{Binding Image}" Width="120" />
                </Button>


                <StackPanel  Style="{StaticResource KivaDetailStyle}"
                             Grid.Row="1" Grid.Column="1">
                    <TextBlock Text="{Binding Location.Country}" Style="{StaticResource KivaTextAccentStyle}" TextWrapping="Wrap"/>
                    <TextBlock Text="{Binding Sector}" Style="{StaticResource KivaTextAccentStyle}" TextWrapping="Wrap"/>
                    <TextBlock Text="{Binding Terms.LoanAmount, Converter={StaticResource toAmount}}" Style="{StaticResource KivaTextAccentStyle}"/>
                    <TextBlock Text="{Binding PostedDate, Converter={StaticResource toShortDate}}" Style="{StaticResource KivaTextAccentStyle}"/>

                </StackPanel>
                
                <TextBlock x:Name="LoanID" Text="{Binding ID}" Visibility="Collapsed"/>

                <StackPanel Grid.Row="2" Grid.ColumnSpan="2"
                    Style="{StaticResource KivaDetailStyle}">
                    <KCtl:TranslationControl x:Name="useTranslation" DataContext="{Binding Description.Texts.Translation}" />
                </StackPanel>
                <my:MediaControl x:Name="media" DataContext="{Binding Description.Texts.Translation}" />

            </Grid>
        </ScrollViewer>
        
        
    </Grid>
</KCtl:BaseUserControl>
